import {
  createStore,
  combineReducers,
  applyMiddleware
} from "redux"

import reducers from "./reducers"
import thunk from "redux-thunk"

import {
  h0
} from "../../common/fp"
import {
  ORDER_DEPART
} from "../constant"

export default createStore(
  combineReducers(reducers), {
    from: null,
    to: null,
    departDate: h0(Date.now()), // 出发日期，默认当天
    highSpeed: false, // 只看高铁动车
    trainList: [],
    orderType: ORDER_DEPART, // 出发早晚或耗时长短
    onlyTickets: false, // 只看高铁动车
    ticketTypes: [], //坐席类型
    checkedTicketTypes: {},
    trainTypes: [], // 车次类型
    checkedTrainTypes: {},
    departStations: [], //  出发车站
    checkedDepartStations: {},
    arriveStations: [], //到达车站
    checkedArriveStations: {},
    departTimeStart: 0,
    departTimeEnd: 24,
    arriveTimeStart: 0,
    arriveTimeEnd: 24,
    isFiltersVisible: false, //该浮层是否显示
    searchParsed: false, // 是否已解析url参数
  },
  applyMiddleware(thunk)
)